package odgs.message.server;

import odgs.Connection;
import odgs.Result;
import odgs.message.Message;
import odgs.message.MessageHandler;
import odgs.message.MessageProcessor;
import odgs.transaction.DirectoryRemoveTransaction;

public class DirectoryRemoveTransactionRequestHandler implements MessageHandler
{
	public void execute(MessageProcessor processor, Message msg, Connection con)
	{	
		DirectoryRemoveTransaction tran  =  (DirectoryRemoveTransaction) msg.get("transaction");
		processor.getServerManager().removeDirectory(tran.getDest().getUid());
		
		msg.setName(Message.DIRCTORY_REMOVE_TRANSACTION_RESPONSE);
		msg.setResult(Result.DIRECTORY_REMOVE_OK);
		processor.getNetworkManager().broadcastMessage(msg);
	}
}